import Vue from 'vue';
import Vuex from 'vuex';
import request from '../utils/request.js'
import { adminInfo } from '../api/login.js';
Vue.use(Vuex);
// 登录验证
export default new Vuex.Store({
    namespaced: true,
    state: {
        user: false,
        asideBarList: [],
        perLevelThird:[],
        isMobile: false,
        showDrawer: false,
        headerZIndex:1,
        baiduMapKey:'',
        adminInfo:{},
    },
    mutations: {
        // 登录
        login(state, user) {
            state.user = user;
            localStorage.setItem("userInfo", user);
        },
        // 退出
        logout(state, user) {
            state.user = "";
            localStorage.setItem("userInfo", "");
        },
        SET_ASIDE_BAR_LIST(state, newVal) {
            state.asideBarList = newVal;
        },
        SET_PER_LEVEL_THIRD(state, newVal) {
            state.perLevelThird = newVal;
        },
        SET_MOBILE_VAL(state, newVal) {
            state.isMobile = newVal;
        },
        SET_DRAWER_VAL(state, newVal) {
            state.showDrawer = newVal;
        },
        SET_HEADER_Z_INDEX(state, newVal){
            state.headerZIndex = newVal
        },
        SET_BAIDU_MAP_KEY(state, newVal){
            state.baiduMapKey = newVal
        },
        SET_ADMIN_INFO(state, newVal){
            state.adminInfo = newVal
        }
    },
    actions: {

    }
})